<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>注册</title>
<meta name="viewport" content="width=device-width, initial-scale=1,maximum-scale=1,user-scalable=no">
<script src="/public/fr_help/js/jquery.js"></script> 
<!--标准mui.css-->
<link rel="stylesheet" href="/public/fr_help/css/mui.min.css">
<!--App自定义的css-->
<link rel="stylesheet" type="text/css" href="/public/fr_help/css/app.css"/>
<script>
	+ function() {
		remLayout();

		function remLayout() {
			var w = document.documentElement.clientWidth;
			w = w > 768 ? 768 : w;
			w = w <= 320 ? 320 : w;
			document.documentElement.style.fontSize = w / 7.5 + 'px';
		}
		window.addEventListener('resize', function() {
			remLayout();
		}, false);
	}();
</script>
</head>
<body >
<header class="mui-bar  mui-bar-nav" style="border-bottom:1px solid #e5e5e5;"><a id="back" class="mui-action-back mui-icon mui-icon-left-nav mui-pull-left"></a>
  <h1 id="title" class="mui-title">领取10元优惠券</h1>
</header>
<div class="mui-content zhuce_count" style="background:#fff;">
	<div class="coupon_box coupon_box_noshadow">
    <div class="coupon_box_img"><img src="/public/fr_help/images/logo.png"></div>
    <div class="coupon_box_bot">
      <div class="coupon_box_price"><small>￥</small>10</div>
      <div class="coupon_box_text">
        <h3>顺风车现金券</h3>
        <p>有效期：1个月</p>
      </div>
    </div>
  </div>
  <div class="regtext_img">
  	<img src="/public/fr_help/images/regbg.png"></div>
  <div class="zhuce_box">
    <form class="loginBox">
    <div class="tel">
      <input type="text" class="text" placeholder="输入手机号接受邀请">
    </div>
    <div class="yzm">
      <input type="text" class="text yanzheng" placeholder="输入验证码">
      <div class="ad-yzm">
        <input id="btnSendCode" type="button" value="获取验证码" onClick="sendMessage()" />
      </div>
    </div>
    <div>
      <button type="button" class="mui-btn mui-btn-block loginbut" >领取10元优惠券</button>
    </div>
  </form>
  </div>
</div> 
<script>
	$('.index_ts .close').click(function(){
		$('.index_ts_cont').hide();
		$('.index_ts_bg').hide();
	});
</script>
<script type="text/javascript">
var InterValObj; //timer变量，控制时间
var count = 60; //间隔函数，1秒执行
var curCount;//当前剩余秒数
var code = ""; //验证码
var codeLength = 6;//验证码长度
function sendMessage() {
curCount = count;
var dealType; //验证方式
var uid=$("#uid").val();//用户uid
if ($("#phone").attr("checked") == true) {
	dealType = "phone";
}
else {
	dealType = "email";
}
//产生验证码
for (var i = 0; i < codeLength; i++) {
	code += parseInt(Math.random() * 9).toString();
}
//设置button效果，开始计时
	$("#btnSendCode").attr("disabled", "true");
	$("#btnSendCode").val( + curCount + "秒再获取");
	InterValObj = window.setInterval(SetRemainTime, 1000); //启动计时器，1秒执行一次
//向后台发送处理数据
	$.ajax({
		type: "POST", //用POST方式传输
		dataType: "text", //数据格式:JSON
		url: 'Login.ashx', //目标地址
		data: "dealType=" + dealType +"&uid=" + uid + "&code=" + code,
		error: function (XMLHttpRequest, textStatus, errorThrown) { },
		success: function (msg){ }
	});
}
//timer处理函数
function SetRemainTime() {
	if (curCount == 0) {                
		window.clearInterval(InterValObj);//停止计时器
		$("#btnSendCode").removeAttr("disabled");//启用按钮
		$("#btnSendCode").val("重新发送验证码");
		code = ""; //清除验证码。如果不清除，过时间后，输入收到的验证码依然有效    
	}
	else {
		curCount--;
		$("#btnSendCode").val( + curCount + "秒再获取");
	}
}
</script>
</body>
</html>
